require('./header.less');
import React from 'react'
import { Link, Control,Route } from 'react-keeper'
import 'weui';

import arrowjd from './../../assets/icon/箭头.png';
import { Page,Panel,PanelHeader,Cells,Cell,CellHeader,CellBody,CellFooter,Badge,CellsTitle,Flex,
  FlexItem,FooterLinks,FooterLink,Button } from  'react-weui/build/packages';

const CellMore = () => (
  <Cell access link>
    <CellBody>More</CellBody>
    <CellFooter />
  </Cell>
)

export default class AppHeaderYeWu extends React.Component {
  constructor(props) {
    super(props);
    this.goHome = this.goHome.bind(this);
    this.setUrlShow = this.setUrlShow.bind(this);
  }

  goHome() {
    this.props.onSetUrlDisplay(true);
    if (Control.path.indexOf('list') > 0)
    {
      Control.go(-1);
    }else
    {
      if (Control.path.indexOf('qrhome') > 0)
      {
        Control.go("/");
      }
      else
      {
        Control.go(-1);
      }

     // Control.go('/');
    }


  }

  setUrlShow() {
    this.props.onSetUrlDisplay(false);
    Control.go(this.props.url);
  }

  render() {
    return (

      <Panel className="head-panel">
        <PanelHeader className="weui-panel__hd_list"  style={{background: 'white', display: 'block'}} >

          <Flex>

            <div className="placeholder">
              {/*<a onClick={ ()=> Control.go(-1) }>*/}
              <a onClick={this.goHome }>
                <img src={arrowjd} style={{width: '20px', display: 'block'}} />
              </a>

            </div>

            <FlexItem>
              <div style={{textAlign:'center'}}>
                <p style={{font: '25px', marginRight: '30px'}}>
                  <h3>{this.props.name}&nbsp;</h3>
                </p>
                </div>
            </FlexItem>
            {/*<a  onClick={ ()=> Control.go(this.props.url) }>*/}
{/*            <div className="placeholder">
              <div className= {this.props.urlDisplay ? 'appheaderdisplay' : 'appheadernone' }   >

                <a  onClick={this.setUrlShow}>
                  查询更多
                </a>
              </div>
            </div>*/}

          </Flex>
        </PanelHeader>
      </Panel>

    )
  }
}

AppHeaderYeWu.propTypes = {
  url: React.PropTypes.object.isRequired,
  name: React.PropTypes.object.isRequired,
  urlDisplay: React.PropTypes.object.isRequired,
}
